package com.springboot.chapter1;
import com.springboot.chapter1.pojo.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;

@SpringBootTest
public class HelloWorldTest {

	@Value("${jdbc.username}")
	private String userName;
	@Value("${password}")
	private String password;
	@Value("${user1.userName}")
	private String use;
	@Value("${city1[3]}")
	private String cityName;
	@Value("${books1[0].name}")
	private String bookName;
	@Test
	void testName(){
		System.out.println("userName："+userName);
		System.out.println("password："+password);
		System.out.println("user1.userName："+use);
		System.out.println("city1[3]："+cityName);
		System.out.println("books1[0].name："+bookName);
	}

	@Autowired
	private Environment environment;
	@Test
	void testEnvironment(){
		System.out.println("username："+environment.getProperty("jdbc.username"));
	}

	@Autowired
	private User user;
	@Test
	void testUser(){
		System.out.println(user);
	}

}
